package ex_6_syncBlockLockAll;


public class Main {
    /**
     *
     *  其他线程执行x对象中synchronized(this)代码块也是同步的
     *
     */
    public static void main(String[] args) {
        MyObject myObject = new MyObject();
        Service service = new Service();
        ThreadA threadA = new ThreadA(myObject,service);
        threadA.setName("A");
        ThreadB threadB = new ThreadB(myObject);
        threadB.setName("B");
        threadA.start();
        threadB.start();
    }
}
